﻿/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2009
' by DotNetNuke Corporation
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.
*/

using MbUnit.Framework;
using WatiN.Core;
using DotNetNuke.Tests.UI.WatiN.Common;
using WatiN.Core.DialogHandlers;
using DotNetNuke.Tests.UI.WatiN.Common.WatiNObjects;
namespace DotNetNuke.Tests.UI.WatiN.SiteTests
{

    [TestFixture]

    public class UserProfileTests : STBase
    {
        #region Test Setup and TearDown

        [SetUp]
        public void SetUp()
        {

            SetUpTest();
        }

        [TearDown]
        public void TearDown()
        {
            TearDownTest();
        }

        #endregion

        #region Tests

        [Test]
        public void Verify_User_Profile_Page_Loads_Correctly_Populates_All_Fields()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Host.UserName, TestUsers.Host.Password);

            loginPage.RegisterLink.Click();
            UserProfilePage profilePage = new UserProfilePage(homePage);
            profilePage.EditProfileLink.Click();
            profilePage.ManageProfileLink.Click();
            System.Threading.Thread.Sleep(2000);
            string prefix = "Mr.";
            string middle = "Sam";
            string suffix = "CA";
            string unit = "99";
            string street = "5587 202A Street";
            string city = "Host City";
            string region = "somewhere";
            string postalCode = "v0m8j6";
            string telephone = "684-957-8523";
            string website = "www.bing.com";
            string IM = TestUsers.Host.Email;
            string biography = "I'm the host for the portal";
            profilePage.FillInProfileFieldsHost(ImagePath, prefix, middle, suffix, unit, street, city, region, postalCode, telephone, website, IM, biography);

            //Assert that the hosts profile page displays correctly
            loginPage.RegisterLink.Click();
            SiteMenu menu = new SiteMenu(homePage);
            Assert.IsTrue(menu.BreadCrumbSpan.Text.Contains("User Profile"));
            Assert.IsTrue(homePage.ModuleTitleSpans.Count == 2);
            Assert.IsTrue(homePage.ModuleTitleSpans[0].Text.Contains("My Profile"));
            Assert.IsTrue(homePage.ModuleTitleSpans[1].Text.Contains("My InBox"));
            Assert.IsFalse(profilePage.ProfileImage.Src.Contains("spacer.gif"));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(TestUsers.Host.DisplayName));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(street));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(city), profilePage.ProfileAddressDiv.InnerHtml);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(region), profilePage.ProfileAddressDiv.InnerHtml);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(postalCode), profilePage.ProfileAddressDiv.InnerHtml);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains("Belgium"));
            Assert.IsTrue(profilePage.ProfileContactInfoDiv.InnerHtml.Contains(telephone + " " + website + " " + IM));
            Assert.IsTrue(profilePage.ProfileBioDiv.InnerHtml.Contains(biography));

            loginPage.LogoffUser();
            System.Threading.Thread.Sleep(1500);
            loginPage.LoginUser(TestUsers.Admin.UserName, TestUsers.Admin.Password);

            //Add Users for testing
            UserPage users = new UserPage(homePage);
            ieInstance.GoTo(SiteURL + "/Admin/UserAccounts.aspx");
            users.AddUser(TestUsers.User1.UserName, TestUsers.User1.Password, TestUsers.User1.FirstName, TestUsers.User1.LastName, TestUsers.User1.EmailAddress, TestUsers.User1.DisplayName);
            System.Threading.Thread.Sleep(2000);

            //Add information to the admin profile
            loginPage.RegisterLink.Click();
            System.Threading.Thread.Sleep(1500);
            profilePage.EditProfileLink.Click();
            profilePage.ManageProfileLink.Click();
            System.Threading.Thread.Sleep(3000);
            prefix = "Dr.";
            middle = "Bert";
            suffix = "M.D.";
            unit = "12";
            street = "123 45A Avenue";
            city = "Fake City";
            region = "somewhere";
            postalCode = "t4t8u9";
            telephone = "123-456-7890";
            website = "www.google.com";
            IM = TestUsers.Admin.Email;
            biography = "I'm the admin for the site";
            profilePage.FillInProfileFieldsAdmin(ImagePath, prefix, middle, suffix, unit, street, city, region, postalCode, telephone, website, IM, biography);

            //Assert that the admins profile loads correctly
            loginPage.RegisterLink.Click();
            System.Threading.Thread.Sleep(1500);
            Assert.IsTrue(menu.BreadCrumbSpan.Text.Contains("User Profile"));
            Assert.IsTrue(homePage.ModuleTitleSpans.Count == 2);
            Assert.IsTrue(homePage.ModuleTitleSpans[0].Text.Contains("My Profile"));
            Assert.IsTrue(homePage.ModuleTitleSpans[1].Text.Contains("My InBox"));
            Assert.IsFalse(profilePage.ProfileImage.Src.Contains("spacer.gif"));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(TestUsers.Admin.DisplayName));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(street));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(city));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(region));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(postalCode));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains("Belgium"));
            Assert.IsTrue(profilePage.ProfileContactInfoDiv.InnerHtml.Contains(telephone + " " + website + " " + IM));
            Assert.IsTrue(profilePage.ProfileBioDiv.InnerHtml.Contains(biography));

            System.Threading.Thread.Sleep(1000);
            ieInstance.GoTo(SiteURL + "/Home.aspx");
            loginPage.LogoffUser();
            System.Threading.Thread.Sleep(1500);
            loginPage.LoginUser(TestUsers.User1.UserName, TestUsers.User1.Password);
            //Add information to the admin profile
            loginPage.RegisterLink.Click();
            profilePage.EditProfileLink.Click();
            profilePage.ManageProfileLink.Click();
            System.Threading.Thread.Sleep(3000);
            prefix = "Ms.";
            middle = "Diane";
            suffix = "BSc";
            unit = "54";
            street = "789 10A Avenue";
            city = "New City";
            region = "somewhere";
            postalCode = "l7l9j7";
            telephone = "454-986-3325";
            website = "www.facebook.com";
            IM = TestUsers.User1.EmailAddress;
            biography = "I'm a user for this site";
            profilePage.FillInProfileFields(ImagePath, prefix, middle, suffix, unit, street, city, region, postalCode, telephone, website, IM, biography);


            //Assert that the users profile loads correctly
            loginPage.RegisterLink.Click();
            Assert.IsTrue(menu.BreadCrumbSpan.Text.Contains("User Profile"));
            Assert.IsTrue(homePage.ModuleTitleSpans.Count == 2);
            Assert.IsTrue(homePage.ModuleTitleSpans[0].Text.Contains("My Profile"));
            Assert.IsTrue(homePage.ModuleTitleSpans[1].Text.Contains("My InBox"));
            Assert.IsFalse(profilePage.ProfileImage.Src.Contains("spacer.gif"));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(TestUsers.User1.DisplayName));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(street));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(city));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(region));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(postalCode));
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains("Belgium"));
            Assert.IsTrue(profilePage.ProfileContactInfoDiv.InnerHtml.Contains(telephone + " " + website + " " + IM));
            Assert.IsTrue(profilePage.ProfileBioDiv.InnerHtml.Contains(biography));
        }

        [Test]
        public void Verify_User_Can_Edit_Profile()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Host.UserName, TestUsers.Host.Password);

            //Act 
            loginPage.RegisterLink.Click();
            System.Threading.Thread.Sleep(1500);
            UserProfilePage profilePage = new UserProfilePage(homePage);

            //Assert 
            MessagingModule msgModule = new MessagingModule(homePage);
            Assert.IsTrue(profilePage.ProfileAddressDiv.Exists);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(TestUsers.Host.DisplayName));
            Assert.IsTrue(profilePage.ProfileImage.Exists);
            Assert.IsTrue(profilePage.EditProfileLink.Exists);
            Assert.IsTrue(msgModule.InboxTable.Exists);

            profilePage.EditProfileLink.ClickNoWait();
            profilePage.ManageProfileLink.Click();
            profilePage.StreetField.Value = "My Street";
            System.Threading.Thread.Sleep(1500);
            profilePage.ProfileUpdateLink.Click();
            System.Threading.Thread.Sleep(4500);
            loginPage.RegisterLink.ClickNoWait();
            System.Threading.Thread.Sleep(1500);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains("My Street"));

            //Act 
            ieInstance.GoTo(SiteURL);
            System.Threading.Thread.Sleep(2500);
            loginPage.LogoffUser();
            System.Threading.Thread.Sleep(1500);
            loginPage.LoginUser(TestUsers.Admin.UserName, TestUsers.Admin.Password);
            loginPage.RegisterLink.Click();

            //Assert 
            Assert.IsTrue(profilePage.ProfileAddressDiv.Exists);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(TestUsers.Admin.DisplayName));
            Assert.IsTrue(profilePage.ProfileImage.Exists);
            Assert.IsTrue(profilePage.EditProfileLink.Exists);
            Assert.IsTrue(msgModule.InboxTable.Exists);

            profilePage.EditProfileLink.Click();
            profilePage.StreetField.Value = "Admin Street";
            profilePage.ProfileUpdateLink.ClickNoWait();
            System.Threading.Thread.Sleep(1500);
            loginPage.RegisterLink.ClickNoWait();

            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains("Admin Street"));

            
            //Add a user for testing
            UserPage users = new UserPage(homePage);
            ieInstance.GoTo(SiteURL + "/Admin/UserAccounts.aspx");
            users.AddUser(TestUsers.User1.UserName, TestUsers.User1.Password, TestUsers.User1.FirstName, TestUsers.User1.LastName, TestUsers.User1.EmailAddress, TestUsers.User1.DisplayName);
            System.Threading.Thread.Sleep(1000);

            //Log in as the user 
            ieInstance.GoTo(SiteURL + "/Home.aspx");
            System.Threading.Thread.Sleep(1500);
            loginPage.LogoffUser();
            System.Threading.Thread.Sleep(1500);
            loginPage.LoginUser(TestUsers.User1.UserName, TestUsers.User1.Password);

            //Act 
            loginPage.RegisterLink.Click();

            //Assert 
            Assert.IsTrue(profilePage.ProfileAddressDiv.Exists);
            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains(TestUsers.User1.DisplayName));
            Assert.IsTrue(profilePage.ProfileImage.Exists);
            Assert.IsTrue(profilePage.EditProfileLink.Exists);
            Assert.IsTrue(msgModule.InboxTable.Exists);

            profilePage.EditProfileLink.Click();
            profilePage.StreetField.Value = "User Street";
            profilePage.ProfileUpdateLink.Click();
            System.Threading.Thread.Sleep(1500);
            loginPage.RegisterLink.Click();
            System.Threading.Thread.Sleep(2500);

            Assert.IsTrue(profilePage.ProfileAddressDiv.InnerHtml.Contains("User Street"));

        }

        [Test]
        public void Verify_New_Image_Profile_Property_Exists()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Host.UserName, TestUsers.Host.Password);

            //Act 
            ieInstance.GoTo(SiteURL + "/tabid/33/portalid/0/language/en-US/Default.aspx");

            //Assert 
            HostListPage listPage = new HostListPage(homePage);
            listPage.DataTypeSpan.Click();
            Assert.IsTrue(listPage.ListTable.InnerHtml.Contains("DotNetNuke.Web.UI.WebControls.DnnImageEditControl, DotNetNuke.Web"));
            Assert.IsTrue(listPage.GetHostListRow("DotNetNuke.Web.UI.WebControls.DnnImageEditControl, DotNetNuke.Web").Exists);
        }

        [Test]
        public void Verify_New_Photo_Profile_Property_Exists()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Admin.UserName, TestUsers.Admin.Password);

            //Act 
            ieInstance.GoTo(SiteURL + "/Admin/UserAccounts.aspx");
            UserPage users = new UserPage(homePage);
            users.ManageProfilePropertiesLink.Click();
            ProfilePropertiesPage propertiesPage = new ProfilePropertiesPage(homePage);

            //Assert 
            Assert.IsTrue(propertiesPage.GetPropertyRow("Photo").Exists);
            TableRow photoRow = propertiesPage.GetPropertyRow("Photo");
            Assert.IsTrue(propertiesPage.GetPropertyDataTypeCell(photoRow).InnerHtml.Contains("Image"));
        }

        [Test]
        [DependsOn("Verify_New_Photo_Profile_Property_Exists")]
        public void Verify_New_Photo_Profile_Property_Is_Editable()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Admin.UserName, TestUsers.Admin.Password);

            //Act 
            ieInstance.GoTo(SiteURL + "/Admin/UserAccounts.aspx");
            UserPage users = new UserPage(homePage);
            System.Threading.Thread.Sleep(1500);
            users.ManageProfilePropertiesLink.Click();
            ProfilePropertiesPage propertiesPage = new ProfilePropertiesPage(homePage);
            propertiesPage.GetPropertyEditButton("Photo").Click();

            //Assert 
           // Assert.IsTrue(propertiesPage.ModuleTitleSpan.InnerHtml.Contains("Edit Profile Property Definition"));
            Assert.IsTrue(propertiesPage.ContentPane.InnerHtml.Contains("Photo"));
            Assert.IsTrue(propertiesPage.DataTypeSelectList.SelectedItem.Contains("Image"));
        }

        [Test]
        [DependsOn("Verify_New_Image_Profile_Property_Exists")]
        public void Verify_New_Image_Profile_Property_Is_Editable()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Host.UserName, TestUsers.Host.Password);

            //Act 
            ieInstance.GoTo(SiteURL + "/tabid/33/portalid/0/language/en-US/Default.aspx");
            HostListPage listPage = new HostListPage(homePage);
            listPage.DataTypeSpan.Click();
            System.Threading.Thread.Sleep(1500);
            listPage.GetHostListEditButton("DotNetNuke.Web.UI.WebControls.DnnImageEditControl, DotNetNuke.Web").Click();

            //Assert 
            System.Threading.Thread.Sleep(1000);
            //Assert.IsTrue(listPage.ListItemTitleSpan.InnerHtml.Contains("Edit List Entry"));
            Assert.IsTrue(listPage.ListEntryField.Text.Contains("DotNetNuke.Web.UI.WebControls.DnnImageEditControl, DotNetNuke.Web"));
        }

        [Test]
        public void Verify_View_Profile_Module_Settings_acsx()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Host.UserName, TestUsers.Host.Password);

            //Add a user for testing
            ieInstance.GoTo(SiteURL + "/Admin/UserAccounts.aspx");
            UserPage users = new UserPage(homePage);
            users.AddUser(TestUsers.User1.UserName, TestUsers.User1.Password, TestUsers.User1.FirstName, TestUsers.User1.LastName, TestUsers.User1.EmailAddress, TestUsers.User1.DisplayName);

            //Act 
            ieInstance.GoTo(SiteURL + "/Home.aspx");
            loginPage.RegisterLink.Click();
            ControlPanel controlPanel = null;
            RibbonBar ribbonBar = null;
            //Act
            if (homePage.ControlPanelElement.Id.Contains(homePage.RibbonBarID))
            {
                ribbonBar = new RibbonBar(homePage);
                ribbonBar.EditCurrentPageLink.Click();
            }
            else
            {
                controlPanel = new ControlPanel(homePage);
                controlPanel.PageSettingsLink.Click();
            }
            PageSettingsPage page = new PageSettingsPage(homePage);
            page.GiveUserEditPermissionsForPage(TestUsers.User1.UserName, TestUsers.User1.DisplayName);
            page.UpdatePageLink.ClickNoWait();
            System.Threading.Thread.Sleep(1000);
            ModuleActionMenu actionMenu = new ModuleActionMenu(homePage);
            loginPage.RegisterLink.ClickNoWait();
            System.Threading.Thread.Sleep(1500);
            actionMenu.ActionMenuManageDiv.FireEvent("onmouseover");
            actionMenu.SettingsActionMenuItem.Click();
            ModulePage moduleSettings = new ModulePage(homePage);
            UserProfilePage profilePage = new UserProfilePage(homePage);

            //Assert 
            Assert.IsTrue(moduleSettings.ModuleTitleTextField.Text.Contains("My Profile"));
            Assert.IsTrue(profilePage.LoadDefaultProfileTemplateLink.Exists);
            ConfirmDialogHandler dialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(ieInstance.DialogWatcher, dialog))
            {
                profilePage.LoadDefaultProfileTemplateLink.ClickNoWait();
                dialog.WaitUntilExists();
                dialog.OKButton.Click();
            }
            System.Threading.Thread.Sleep(1000);
            Assert.IsTrue(profilePage.ProfileTemplateTextField.Text.Contains("<div id=\"UserProfile\">"));
            Assert.IsTrue(profilePage.ProfileTemplateTextField.Text.Contains("	<img alt=\"Profile Avatar\" class=\"ProfilePhoto\" width=\"120\" height=\"120\" src=\"[PROFILE:PHOTO]\" />"));

            //Repeat test as an admin
            ieInstance.GoTo(SiteURL);
            System.Threading.Thread.Sleep(1500);
            loginPage.LogoffUser();
            System.Threading.Thread.Sleep(1500);
            loginPage.LoginUser(TestUsers.Admin.UserName, TestUsers.Admin.Password);
            loginPage.RegisterLink.Click();
            //actionMenu.ModuleActionMenuImage.FireEvent("onmouseover");
            actionMenu.SettingsActionMenuItem.Click();

            //Assert 
            Assert.IsTrue(moduleSettings.ModuleTitleTextField.Text.Contains("My Profile"));
            Assert.IsTrue(profilePage.LoadDefaultProfileTemplateLink.Exists);
            dialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(ieInstance.DialogWatcher, dialog))
            {
                profilePage.LoadDefaultProfileTemplateLink.ClickNoWait();
                dialog.WaitUntilExists();
                dialog.OKButton.Click();
            }
            System.Threading.Thread.Sleep(1000);
            Assert.IsTrue(profilePage.ProfileTemplateTextField.Text.Contains("<div id=\"UserProfile\">"));
            Assert.IsTrue(profilePage.ProfileTemplateTextField.Text.Contains("	<img alt=\"Profile Avatar\" class=\"ProfilePhoto\" width=\"120\" height=\"120\" src=\"[PROFILE:PHOTO]\" />"));

            //Repeat the test as the test user
            ieInstance.GoTo(SiteURL);
            System.Threading.Thread.Sleep(1500);
            loginPage.LogoffUser();
            System.Threading.Thread.Sleep(1500);
            loginPage.LoginUser(TestUsers.User1.UserName, TestUsers.User1.Password);
            loginPage.RegisterLink.Click();
            //actionMenu.ModuleActionMenuImage.FireEvent("onmouseover");
            actionMenu.SettingsActionMenuItem.ClickNoWait();

            //Assert 
            Assert.IsTrue(moduleSettings.ModuleTitleTextField.Text.Contains("My Profile"));
            Assert.IsTrue(profilePage.LoadDefaultProfileTemplateLink.Exists);
            dialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(ieInstance.DialogWatcher, dialog))
            {
                profilePage.LoadDefaultProfileTemplateLink.ClickNoWait();
                dialog.WaitUntilExists();
                dialog.OKButton.Click();
            }
            System.Threading.Thread.Sleep(1000);
            Assert.IsTrue(profilePage.ProfileTemplateTextField.Text.Contains("<div id=\"UserProfile\">"));
            Assert.IsTrue(profilePage.ProfileTemplateTextField.Text.Contains("	<img alt=\"Profile Avatar\" class=\"ProfilePhoto\" width=\"120\" height=\"120\" src=\"[PROFILE:PHOTO]\" />"));

        }

        [Test]
        public void Verify_Advanced_Settings_Change_In_SiteSettings()
        {
            //Arrange
            WatiNBase homePage = new WatiNBase(ieInstance, SiteURL, DatabaseName);
            LoginPage loginPage = new LoginPage(homePage);
            loginPage.LoginUser(TestUsers.Admin.UserName, TestUsers.Admin.Password);

            //Act 
            ieInstance.GoTo(SiteURL + "/Admin/SiteSettings.aspx");
            SiteSettingsPage settingsPage = new SiteSettingsPage(homePage);
            settingsPage.AdvancedSettingsTab.ClickNoWait();

            //Assert
            Assert.IsTrue(settingsPage.UserProfilePageSelectList.SelectedItem.Equals("User Profile"));
            Assert.IsFalse(settingsPage.UserProfilePageSelectList.Option("<None Specified>").Exists);

            settingsPage.UserProfilePageSelectList.Select("Home");
            settingsPage.UpdateLink.ClickNoWait();
            ieInstance.GoTo(SiteURL + "/Home.aspx");
            System.Threading.Thread.Sleep(1000);
            ieInstance.GoTo(SiteURL + "/Admin/SiteSettings.aspx");
            settingsPage.AdvancedSettingsTab.ClickNoWait();
            Assert.IsTrue(settingsPage.UserProfilePageSelectList.SelectedItem.Equals("Home"));
        }


        #endregion

        #region Private Methods

         

        #endregion
    }
}